
//
//  TabBarController.swift
//  RoundCatPlay2
//
//  Created by 姜澎 on 2019/10/18.
//  Copyright © 2019 jiangpeng. All rights reserved.
//

import UIKit
import SnapKit
class TabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
      
        setVC()
    }

}

extension TabBarController{
    
    func setTabBarChildViewContoller(viewController: UIViewController,title: String,tabBarTitle:  String,tabBarSelectImage:String,tabBarImage:String) {
        
        viewController.title = title
        viewController.tabBarItem.title = tabBarTitle
        viewController.tabBarItem.image = UIImage.init(named:tabBarImage)?.withRenderingMode(.alwaysOriginal)
        viewController.tabBarItem.selectedImage = UIImage.init(named:tabBarSelectImage)?.withRenderingMode(.alwaysOriginal)
        let nc = NavigationContoller(rootViewController: viewController)
        addChild(nc)
    }
    func setVC(){
        setTabBarChildViewContoller(viewController: MainViewController(), title: "", tabBarTitle: "首页", tabBarSelectImage: "home1", tabBarImage: "home2")
        setTabBarChildViewContoller(viewController:  MessageTableViewController(), title: "", tabBarTitle: "消息", tabBarSelectImage: "sm", tabBarImage: "消息")
        
      
        setTabBarChildViewContoller(viewController: MyViewController(), title: "", tabBarTitle: "我的", tabBarSelectImage: "my01", tabBarImage: "我的")
        
        
    }
}
